package com.lihepeng.leecode.frequency.tree;

/**
 * 二叉树的深度
 */
public class Solution28 {
    public int maxDepth (TreeNode root) {
        // write code here
        if (root ==null) {
            return 0;
        }
        return getDepthTree(root);
    }

    private int getDepthTree(TreeNode root) {
        if (root ==null) {
            return 0;
        }
        return Math.max(getDepthTree(root.left),getDepthTree(root.right))+1;
    }
}
